package com.itheima.demo4;

import java.io.File;
import java.io.IOException;

public class FileDemo4 {
    public static void main(String[] args) throws IOException {
/*

        File file = new File("aaa");
        file.mkdirs();

        File file1 = new File(file,"a.txt");
        file1.createNewFile();
*/

        //需求：找到电脑中所有的avi结尾的电影
        File[] files = File.listRoots();
        for (File file : files) {
            findAVI(file);
        }


    }

    public static void findAVI(File file){
        File[] files = file.listFiles();
        if (files != null) {
            for (File file1 : files) {
                if (file1.isFile()){
                    String name = file1.getName();
                    if (name.endsWith(".avi")){
                        System.out.println(file1);
                    }
                }else {
                    findAVI(file1);
                }
            }
        }
    }

}
